import React from 'react'
import {getMovieAction} from '../../store/slice/movieSlice'
import { useDispatch,useSelector } from 'react-redux'

export default function Movie (){
  const dispatch = useDispatch()
    const getMovieListHandle =()=>{
           dispatch(getMovieAction())
    }
    const count = useSelector((state)=>state.count.count)
    const movieList = useSelector((state)=>state.movie.movieList)
    return( 
        <div>
            <h1>我是Movie组件,我用的是count组件中的{count}</h1>
            <button onClick={getMovieListHandle}>获取电影信息</button>
            <ul>
                {
                    movieList.map((item)=>{
                            return <li key={item.tvId}>{item.albumName}</li>
                    })
                }
            </ul>
        </div>
    )
}